#
# global platform config.mk prior to the local configuration
#
include $(WORKDIR)/config.mk

CUR_DIR := $(shell pwd)
LOCAL_INC_DIR := $(CUR_DIR)/include $(PLAT_INNER_INC) $(MPI_INC_DIR)
CFLAGS += $(addprefix -I,$(LOCAL_INC_DIR))

ifeq ($(CONFIG_DANA_SUPPORT), y)
CFLAGS += -DCONFIG_DANA_SUPPORT=1
endif
ifeq ($(CONFIG_ONVIF_SUPPORT), y)
CFLAGS += -DCONFIG_ONVIF_SUPPORT=1
endif
ifeq ($(CONFIG_RTSP_SUPPORT), y)
CFLAGS += -DCONFIG_RTSP_SUPPORT=1
endif

TARGET_DIR := $(CUR_DIR)/output/
export TARGET_DIR CFLAGS LDFLAGS

dir_y := main
dir_y += config
dir_y += misc
dir_y += record

ifeq ($(CONFIG_DANA_SUPPORT), y)
	dir_y += dana
	DANA_LIB_DIR := $(CUR_DIR)/dana/lib
	export DANA_LIB_DIR
endif

dir_y += monitor
dir_y += output

all:
	@for i in $(dir_y); \
	do \
		$(MAKE) -C $$i; \
		if [ $$? -ne 0 ];then exit 1; fi \
	done

install:
	@for i in $(dir_y); \
	do \
		$(MAKE) -C $$i install; \
	done

clean:
	@$(MAKE) -C output clean

.PHONY: all install clean
